package com.timer.taskRule.utils;

import com.timer.taskRule.entity.User;

import java.util.Random;

public class RandomData {

	private final static String[] lastName = {"赵","钱","孙","李","周","吴","郑","王"};

	private final static String[] name = {"翠花","二狗","傲天","日地","佩奇","狗蛋","傻子","秀儿"};

	private final static String[] pwd = {"a","b","c","d","e","f","g","h","i","j"};

	public static User random(){
		User user = new User();
		Integer lastNameIndex = new Random().nextInt(lastName.length);
		Integer nameIndex = new Random().nextInt(name.length);
		user.setUserName(lastName[lastNameIndex] + name[nameIndex]);

		StringBuffer userPwd = new StringBuffer();
		for (int i = 0; i < 6; i++) {
			Integer pwdIndex = new Random().nextInt(pwd.length);
			userPwd.append(pwd[pwdIndex]);
		}
		user.setUserPwd(userPwd.toString());

		user.setSortNum(new Random().nextInt(100));

		return user;
	}
}
